package com.hengtuo.student.dao.impl;

import java.util.Collection;
import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.hengtuo.student.dao.ScoreDao;
import com.hengtuo.student.dao.base.impl.BaseDaoImpl;
import com.hengtuo.student.pojo.Course;
import com.hengtuo.student.pojo.Score;
import com.hengtuo.student.pojo.User;

/**
 * 
 * @author �¿���
 * ʵ�ֳɼ�����ݿ����
 *
 */
@Repository("scoreDaoImpl")
public class ScoreDaoImpl extends BaseDaoImpl<Score> implements ScoreDao<Score> {

	@Override
	public void deleteScorByCourseId(String courseId) {
		String hql ="from Score where courseId=:courseId";
		Query query =this.getSession().createQuery(hql);
		query.setString("courseId",courseId);
		List<Score> scoresList =this.getSession().createQuery(hql).list();
		if (scoresList!=null&&scoresList.size()!=0) {
			for (Score score : scoresList) {
				this.getSession().delete(score);
			}
		}
	}
}
